package supimpa.src;

import supimpa.util.PNGLoader;

public class WorldRenderer {
	
	static RenderManager renderManager = new RenderManager();
	
	public WorldRenderer(){
		
		PNGLoader.setupTextures(MainClass.class.getClassLoader().getResourceAsStream("res/minecraft.png"));
	}

	public void renderBlocks(Block[][][] allBlocks){
		
		int lenght = allBlocks.length;
		
		for (Class<? extends Block> bloClass : renderManager.blockList)
			for (int x = 0; x < lenght; x++)
				for (int y = 0; y < lenght; y++)
					for (int z = 0; z < lenght; z++){
						
						Block block = allBlocks[x][y][z];
						if (bloClass.isInstance(block)){
							
							renderBlock(new int[]{x,y,z}, 0, block.texIndex);
						}
					}
	}
	
	private void renderBlock(int[] position, int meta, int meta2){
		
		CommonRenders.normalBlock.render(position, meta, meta2);
	}
	
	private boolean canFaceBeSeen(int face, int[] position){
		
		return true; //TODO
	}
	
	
	
	
	
	
	
	
	
	
}
